﻿
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[sproc_Task_AddSubscription]') AND type in (N'P', N'PC'))
    DROP PROCEDURE [dbo].[sproc_Task_AddSubscription];
GO
CREATE PROCEDURE [dbo].[sproc_Task_AddSubscription]
    @Username nvarchar(300),
    @ExUsername nvarchar(300),
    @TaskID int, 
    @Date datetime
AS
if  not exists(select * from uds_task_subscription where Username=@Username and ExUsername=@ExUsername and TaskID=@TaskID and Date=@Date)
begin
INSERT INTO uds_task_subscription (TaskID,Username,Date,ExUsername)
    VALUES(@TaskID,@Username,@Date,@ExUsername)
end